package org.blade.personal.test;

import java.util.List;

import org.blade.personal.framework.dsl.sql.Sql;
import org.blade.personal.framework.dsl.sql.concre.MySQLSql;
import org.blade.personal.framework.jdbc.datasource.DataSource;
import org.blade.personal.framework.jdbc.datasource.concre.SimpleDataSource;
import org.blade.personal.framework.session.DslSession;
import org.blade.personal.framework.session.concre.StandardDslSession.StandardDslSession;

public class Main {
	
	

	public static void main(String[] args) {

		Sql mysql = new MySQLSql("bb");

	/*	MyEntity e = new MyEntity("entity");
		
		Organ o = new Organ("o");

		mysql.from(e) .rightJoin(o) .on(e.id.eq(o.id)) .where(e.id.eq(2)) 
		.list(e.age.max(), o.name.min().as("minName"),o.id);
		*/
		
		Role role = new Role("r");
		Role role1 = new Role("r1");
		mysql.from(role).leftJoin(role1).on(role.id.eq(role1.id)).where(role.id.eq(9)).list(role.id, role.name);
		
		mysql.and(role.id.eq(9));
		System.out.println(mysql.get());
		DataSource ds = new  SimpleDataSource();
		
		DslSession session = new StandardDslSession(ds);

		List<MyEntity>  myEntities =  session.create(mysql).getResultlist();

	}
}
